/*
 * @Author: NtyAaron
 * @Date: 2021-04-17 15:49:49
 * @LastEditors: NtyAaron
 * @LastEditTime: 2021-05-10 15:36:26
 * @Description: file content
 * @FilePath: \dwq\i18n\base.js
 */
// 获取本地语言配置
function getLanguage() {
  return wx.getStorageSync('language') || 'zh'
}
// zh en tw
function getLanguageType() {
  const lang = wx.getStorageSync('language')
  if (lang == 'zh') {
    return 1
  } else if (lang == 'tw') {
    return 2
  } else {
    return 3
  }
}
// 返回对应的翻译信息  require方法用于加载模块
function translate() {
  return require(getLanguage() + '.js').languageMap
}
//翻译
// function translateTxt(desc) {
//   return translate()[desc] || '竟然没有翻译'
// }  module.exports 导出
module.exports = {
  getLanguage: getLanguage,
  _to: translate(),
  _t: translate,
  _type: getLanguageType,
}
